package net.cyue.web.easyquery.core.http.handler;

import net.cyue.web.easyquery.core.http.api.IHTTPRequest;
import net.cyue.web.easyquery.core.http.api.IHTTPResponse;
import net.cyue.web.easyquery.core.http.handler.api.IWebRequestPreHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Date;

public class RequestLogPreHandler implements IWebRequestPreHandler {

    private final Logger logger = LoggerFactory.getLogger(this.toString());

    @Override
    public boolean preHandle(IHTTPRequest request, IHTTPResponse response) throws IOException {
        logger.info("[{}][{}] {}", new Date(), request.remoteHost(), request.uri());
        return true;
    }
}
